Skip to content

Skip regenerating LICENSE if --license not given#290

Merged
swissspidy merged 1 commit intowp-cli:mainfrom
ara303:fix/skip-regen-readme
Apr 21, 2026
Merged

Skip regenerating LICENSE if --license not given#290
swissspidy merged 1 commit intowp-cli:mainfrom
ara303:fix/skip-regen-readme

Conversation

@ara303
Copy link
Copy Markdown
Contributor

@ara303 ara303 commented Apr 21, 2026

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies ScaffoldPackageCommand.php to ensure that composer.json and the LICENSE file are only updated when the --license flag is explicitly provided. This is achieved by introducing a $license_provided boolean to gate the license-related logic. I have no feedback to provide.

@ara303
Copy link
Copy Markdown
Contributor Author

ara303 commented Apr 21, 2026

As-is, this PR alone should fix both of @swissspidy's comments:

Hmm I don't like how this now changes the existing MIT license for this project... see #289

That will be super noisy when we get PRs for every package for this. Plus, I'm wary of changing the copyright line like this.

If I don't explicitly pass --license and the project already has a license set, we should not be changing anything.

Skip everything license-related when caling wp scaffold package-readme <dir> [--other-flags] without --license.

Regarding the copyright line changing in this repo's LICENSE file, that's because the copyright line was manually amended (to add contributor credit).

In other words, even before #288 the copyright line in this repo's LICENSE file couldn't be generated like that because it's a manual change. It's not a regression as I first feared. 😅

Skipping all license-related changes if --license isn't given preserves manual changes appropriately now.

Copy link
Copy Markdown
Member

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Let's guve this a try :)

@swissspidy swissspidy added this to the 2.2.4 milestone Apr 21, 2026
@swissspidy swissspidy merged commit d3ac6c4 into wp-cli:main Apr 21, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants